#include "Wrappers.h"

///---------------------------------------
/// HANDLE guard
HandleGuard::HandleGuard(HANDLE _handle)
	: handle(_handle)
{ }

HandleGuard::~HandleGuard(void)
{
	if (!CloseHandle(handle))
	{
		__debugbreak();
	}
}

HANDLE HandleGuard::Get()
{
	return handle;
}

///----------------------------------------
/// SC_HANDLE guard
ServiceHandleGuard::ServiceHandleGuard( SC_HANDLE _sc_handle = NULL ) 
	: sc_handle(_sc_handle)
{ }

ServiceHandleGuard::~ServiceHandleGuard(void)
{
	if(!CloseServiceHandle(sc_handle))
	{
		__debugbreak();
	}
}

SC_HANDLE ServiceHandleGuard::Get()
{
	return sc_handle;
}

///----------------------------------------
/// QFile guard
FileGuard::FileGuard(QFile& _file) 
	: qfile(_file)
{
}


FileGuard::~FileGuard(void)
{
	qfile.close();
}